@extends('home.base.index')

@section('content')
    <!--内容开始-->
    <div class="personal w1200">
    	<div class="personal-left f-l">
        	<div class="personal-l-tit">
            	<h3>个人中心</h3>
            </div>
            <ul>
            	   <li class="current-li per-li1"><a href="#">消息中心<span>></span></a></li>
                <li class="per-li2"><a href="{{url('/home/userinfo')}}">个人资料<span>></span></a></li>
                <li class="per-li3"><a href="/home/userorder">我的订单<span>></span></a></li>
                <li class="per-li6"><a href="/home/address">管理收货地址<span>></span></a></li>
                <li class="per-li7"><a href="/home/interest">商品收藏<span></span></a></li>
                <li class="per-li8"><a href="/home/okconfirm">确认收货<span>></span></a></li>
                <li class="per-li9"><a href="#">浏览记录<span>></span></a></li>
                <li class="per-li10"><a href="#">会员积分<span>></span></a></li>
            </ul>
        </div>
    	<div class="personal-r f-r">
           <div class="management f-r">
            <div class="tanchuang-con">
                <div class="tc-title">
                    <h3>确认收货</h3>
                </div>
                <div class="man-info">
                <table class="table tile">
                <div class="man-if-con">
                    <div class="man-tit">
                        <p class="p2">商品信息</p>
                        <p class="p3">价格</p>
                        <p class="p4">状态</p>
                        <p class="p6">操作</p>
                    </div>
                      @if (empty($okconfirm))
                           
                      @else
                          @foreach($okconfirm as $v)
                             <ul class="man-ul1">
                                <li>
                                    <p class="p2">{{$v->name}}</p>
                                    <p class="p3">{{ $v->total_price }}</p>
                                    <p class="p4" id="changestatus">{{ $v->status  == '3'?'已发货':'已收货' }}</p>
                                    <p class="p4" id="{{ $v->id }}" >
                                    <a  href="javascript:dookconfirm({{ $v->id }})">确认收货</a>
                                    <div style="clear:both;"></div>
                                </li>
                             </ul>  
                                   @endforeach
                    @endif   
                </div>
            </table>
    </div>
     </div>
   
    <script type="text/javascript">


  function dookconfirm(id){
            var url = "{{ url('home/aja/dookconfirm') }}";
            console.log(id);
            $.ajax({
            url:url,
            async:false,                //是否异步
            type:'get',                 //请求方式
            data:{id:id},              //发送的数据
            dataType:'json',            //响应的数据类型
            error:function()            //失败时回调函数
            {
                alert('ajax请求失败');
            },
            success:function(data)      //成功时回调函数
            {
                if(data==1){
                  $('#changestatus').html('已收货');
                   alert("已确认收货，前往订单评价吧"); 
                   window.location.href="{{url('/home/userorder')}}";
                }
                
                
            }
        });
        }
    </script>
 @stop